import xadmin
from xadmin import views

from .models import BannerInfo

from .models import NavInfo

class BaseSetting(object):
    """xadmin的基本配置"""
    enable_themes = True  # 开启主题切换功能
    use_bootswatch = True  # 开启控制盘

# 将基本配置注册到xadmin中
xadmin.site.register(views.BaseAdminView, BaseSetting)

class GlobalSettings(object):
    """xadmin的全局配置"""
    site_title = "路飞学城"  # 设置站点标题
    site_footer = "路飞学城有限公司"  # 设置站点的页脚
    menu_style = "accordion"  # 设置菜单折叠

xadmin.site.register(views.CommAdminView, GlobalSettings)


# 轮播图
class BannerInfoModelAdmin(object):
    '''轮播模型管理器'''
    list_display=["name","orders","is_show"]
xadmin.site.register(BannerInfo, BannerInfoModelAdmin)


# 导航
class NavInfoModelAdmin(object):
    '''导航模型管理器'''
    list_display=["name","link","is_show"]
xadmin.site.register(NavInfo, NavInfoModelAdmin)